<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <c:set var="ctx" value="${pageContext.request.contextPath}"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>查询征信记录(客车)</title>
    <jsp:include page="../../import.jsp" flush="true"/>
    <input type="hidden" value="${prjId}" name="prjId" id="prjId"/>
</head>
<script type="text/javascript">
    var grid = null;
    var addGSData_s = {};
    var addSONData_s = {};
    $(function () {
        var _url = '<%=path%>/riskctrl/rccstbscinfo/initList.do?certNo=${certNo }&prdTyp=4';
        $("#ligergrid1").ligerGrid({
            url: _url,
            method: 'get',
            columns: [
                {display: '类型', name: 'cstTypCdNm', align: 'left', width: 50},
                {display: '客户姓名', name: 'cstNm', align: 'left', width: 100},
                {display: '手机号', name: 'mp1', align: 'left', width: 100},
                {display: '证件号', name: 'certNo', align: 'left', width: 200},
                {
                    display: '有效性', align: 'left', width: 50,
                    render: function (rowdata, rowindex, value) {
                        if (rowdata.isValidNm == "有效") {
                            return '<font color="blue">'+rowdata.isValidNm+'</font>';
                        }
                        return rowdata.isValidNm;
                    }
                },
                {display: '复议', name: 'isReaudNm', align: 'center', width: 50},
                {
                    display: '评审结果', align: 'left', width: 200, isEllipsis: false,
                    render: function (rowdata, rowindex, value) {
                        if (rowdata.audStsDesc4 != null && rowdata.audStsDesc4 != 'null' && rowdata.audStsDesc4.indexOf("【工行】") == 0) {
                            return rowdata.audStsDesc4 + rowdata.audStsDesc;
                        } else {
                            return rowdata.audStsDesc;
                        }
                    }
                },
                {display: '经销商风险', name: 'splRiskInfo', align: 'center', width: 300},
                {display: '审批意见1', name: 'audOpinion', align: 'center', width: 200},
                {display: '审批意见2', name: 'audOpinion2', align: 'center', width: 200},
                {display: '用户级别', name: 'rskLvlCdNm', align: 'left', width: 50},
//                {display: '特别说明', name: 'cstRem', align: 'left', width: 150},
//                {display: '结果说明', name: 'audStsDesc2', align: 'left', width: 150},
                {display: '所属机构', name: 'cstMgrOrgCdNm', align: 'left', width: 100},
                {display: '省公司', name: 'prOrgCdNm', align: 'left', width: 150},
                {display: '分公司', name: 'cyOrgCdNm', align: 'left', width: 150},
                {display: '车型', name: 'prdTypCdNm', align: 'left', width: 50},
                {display: '贷款额（元）', name:'prdAmt', align: 'left', width: 150,},
                {display: '行驶证', name: 'driveIdHolderCdNm', align: 'left', width: 100},
                {display: '婚姻状况', name: 'marStsCdNm', align: 'center', width: 100},
                {display: '配偶/担保人信息', name: '', align: 'left', width: 150},
                {display: '经销商', name: 'splNm', align: 'left', width: 150},
                {display: '业务员', name: 'crtNm', align: 'left', width: 150},
                {display: '客户经理', name: 'cstMgrNm', align: 'left', width: 100},
                {display: '授权书', align: 'left', width: 150,
                    render: function (rowdata, rowindex, value){
                        var h;
                        h='<a href="javascript:uploadFileByUrl(';
                        h+="'"+rowdata.authFilePath+"'";
                        h+=",'"+rowdata.authFileNm+"'";
                        h+=')">'+rowdata.authFileNm+'</a>'
                        return h;
                    }
                },
                {display: '电子征信授权书', name: 'zxFilePath', align: 'center', width: 110,
              	  render:function (rowdata, rowindex, value, column) {
                		if(rowdata.zxFilePathStatus == 1){
                    		return '<a href="javascript:toGetPath('+"'"+rowdata.id+"'"+');" >查看征信授权书</a>';
                		}
                	}
                },
                {display: '短信状态', name: 'mpMsgCdNm', align: 'center', width: 150,
              	   
                },
                {display: '短信内容', name: 'mpMsgDesc', align: 'left', width: 150},
                {display: '身份证', align: 'center', width: 100,
                    render: function (rowdata, rowindex, value){
                        var h;
                        h='<a href="javascript:uploadFileByUrl(';
                        h+="'"+rowdata.idCardFilePath+"'";
                        h+=",'"+rowdata.idCardFileNm+"'";
                        h+=')">'+rowdata.idCardFileNm+'</a>'
                        return h;
                    }
                },
                {display: '状态', name: 'audStsCdNm', align: 'left', width: 100},
                {display: '时间', name: 'crtTm', align: 'center', width: 150, render: renderDate},
                {
                    display: '操作', width: 150, align: 'left',
                    render: function (rowdata, rowindex, value) {
                    	var html = '<sys:funcAuth resCd="cpshow2709"><a class="sq-button-hasicon" href="javascript:change(' + "'" + rowdata.id + "'," + "'" + rowdata.prdTyp + "'" + ',1)"><i class="sqBtnIco_4"></i>复议</a></sys:funcAuth>'
                        + '<sys:funcAuth resCd="cpshow2708"><a class="sq-button-hasicon" href="javascript:change(' + "'" + rowdata.id + "'," + "'" + rowdata.prdTyp + "'" + ',2)"><i class="sqBtnIco_4"></i>查看</a></sys:funcAuth>';
                    	return html;
                    }
                }
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            checkbox: false,
            rownumbers: true,
            frozen: false,
            allowUnSelectRow: true,
            alternatingRow: false,
            fixedCellHeight: false,
            onBeforeShowData: function () {
                var grid = this;
                grid.collapsedRows = [];
            },
            detail: {
                height: 'auto',
                onShowDetail: showDetail_grid
            }
        });
        grid = liger.get("ligergrid1");
        grid.setHeight(100);
        $("#searchBar").ligerForm();

        $("#searchBtn").click(function (event) {
            var form = new liger.get("searchBar");
            var data = form.getData();
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            grid.reload();
        });
        $("#clearBtn").click(function (event) {
            //$("#resetBtn").click();  //重置 input-text
            clearQuery();
        });
        
    });
  	//客户关系明细列表
    function showDetail_grid(row, detailPanel, callback){
        var gridBox = document.createElement('div');
        $(gridBox).css('margin', 10);
        $(detailPanel).css({
            'padding': 10,
            'box-sizing': 'border-box'
        }).append(gridBox);
        detailGrid = $(gridBox).ligerGrid({
        	url: '<%=path%>/riskctrl/rccstbscinfo/initCstSocialList.do?cstId='+ row.id,
            method: 'get',
            columns: [
                {display: '姓名',name: 'rlNm',width: 180,align:'center'},
                {display: '性别', name: 'genderCdNm', width: 50, align: 'center'},
                {display: '客户关系', name: 'rlTypCdNm', width: 80, align: 'center'},
                {display: '出生日期',name: 'birthdayStr',width: 150,align:'center'},
                {display: '证件类型',name: 'certTypCdNm', width: 100,align:'center',},
                {display: '证件号', name: 'certNo', width: 180, align: 'center'},
                {display: '手机号码(1)', name: 'mp1', width: 180, align: 'center'},
                {display: '手机号码(2)', name: 'mp2', width: 180, align: 'center'},
                {display: '授权书', align: 'center', width: 150,
                    render: function (rowdata, rowindex, value){
                        var h;
                        h='<a href="javascript:uploadFileByUrl(';
                        h+="'"+rowdata.authFilePath+"'";
                        h+=",'"+rowdata.authFileNm+"'";
                        h+=')">'+rowdata.authFileNm+'</a>'
                        return h;
                    }
                },
                {display: '电子征信授权书', name: 'zxFilePath', align: 'center', width: 110,
                	  render:function (rowdata, rowindex, value, column) {
  	              		if(rowdata.zxFilePathStatus == 1){
  	              			return '<a href="javascript:toGetPath('+"'"+rowdata.id+"'"+');" >查看征信授权书</a>';
  	              		}
                  	}
                  },
                {display: '身份证', align: 'center', width: 100,
                    render: function (rowdata, rowindex, value){
                        var h;
                        h='<a href="javascript:uploadFileByUrl(';
                        h+="'"+rowdata.idCardFilePath+"'";
                        h+=",'"+rowdata.idCardFileNm+"'";
                        h+=')">'+rowdata.idCardFileNm+'</a>'
                        return h;
                    }
                },
            ],
            root: 'rows',
            hideLoadButton : true,
            width: '100%',
            height: 'auto',
            isScroll: false,
            rownumbers:true,  //显示序号
            allowUnSelectRow:true,
            alternatingRow: false,
            onAfterShowData: callback,
            frozen: false,
            usePager: false
        });
    }
    function uploadFileByUrl(_url,_name){
        if(SQ.regs.img.test(_name)){
            //SQ.imgPreview(_url);
            window.__ImgSrc = _url;
            window.__ImgTit = _name;
            window.open('<%=path%>/project/prjbscinfo/imgWinOpen.do', '', 'location=yes, width=800, height=600');
        }else{
            window.open(_url);
        }
    }
    function change(id, prdTyp, zx_flag) {
        if(!id)return;

        var desc = "";
        if(zx_flag == "1") {
            desc = "-复议";
        }
        if(zx_flag == "2") {
            desc = "-查看";
        }

        Add_navTab("toTripartitePage"+id+"_"+zx_flag, "客车前置征信审批"+desc, '<%=path%>/riskctrl/rccstbscinfo/toKcAudiPage.do?id='+id+'&zx_flag='+zx_flag);
    }
    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
        }
        return dateStr;
    }
    function toGetPath(id){
    	$.ajax({
            type: 'get',
            dataType: 'json',
            url: '<%=path%>/riskctrl/rccstbscinfo/getFilPath.do?filId='+id,
            success: function (msg) {
                if (msg.success == 1) {
                	window.open(msg.info)
                } else {
                	$.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    }
    
  	// 清空约束条件
  	function clearQuery(){
  		$("#cstNm").val("");  // 客户姓名
  		$("#certNo3").val("");  // 证件号
  		$("#mp").val("");  // 手机号
  		$("#splNm").val("");  // 商家名称
  		
  		liger.get("audStsCd").setValue(" ");  // 评审状态
  		liger.get("rskLvlCd").setValue(" ");  // 用户级别
  		liger.get("isReaud").setValue(" ");  // 是否复议
  	}
  	
</script>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">客户姓名</div>
                    <div class="field">
                        <input name="cstNm" id="cstNm" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">证件号</div>
                    <div class="field">
                        <input name="certNo3" id="certNo3" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">手机号</div>
                    <div class="field">
                        <input name="mp" id="mp" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">商家名称</div>
                    <div class="field">
                        <input name="splNm" id="splNm" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">评审状态</div>
                    <div class="field">
                        <select name="audStsCd" id="audStsCd" data-value=" ">
                            <option value=" " seleted>请选择</option>
                            <c:forEach items="${audStsCdDicList }" var="kv">
                                <option value="${kv.key }">${kv.value }</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">用户级别</div>
                    <div class="field">
                        <select name="rskLvlCd" id="rskLvlCd" data-value=" ">
                            <option value=" " seleted>请选择</option>
                            <c:forEach items="${usLevelDicList }" var="kv">
                                <option value="${kv.key }">${kv.value }</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">是否复议</div>
                    <div class="field">
                        <select name="isReaud" id="isReaud" data-value=" ">
                            <option value=" " seleted>请选择</option>
                            <c:forEach items="${yesNoDicList }" var="kv">
                                <option value="${kv.key }">${kv.value }</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>
                
                <div class="clearFix"></div>
                <div class="btnsBox formBtns notRight">
                    <span id="searchBtn" class="sq-button-round">查询</span>
                    <span id="clearBtn" class="sq-button-round">清空</span>
                    <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                </div>
            </div>
            
            <div class="" id="aCardCPBeforeLabelNm"> </div>
             <div class="" id="aCardCPBeforeResult"> </div>
             
             <div class="" id="aCardCPAfterLabelNm"> </div>
             <div class="" id="aCardCPAfterResult"> </div>
             
             
             <div class="label" id="aCardSPLabelNm"> </div>
             <div class="label" id="aCardSPResult"> </div>
             
        </form>
    </div>
</div>
<div id="ligergrid1" class="sq-grid"></div>
</body>
</html>